class Solution(object):
    def lengthOfLastWord(self, s):
        """
        :type s: str
        :rtype: int
        """
        s = s.rstrip(' ')   #针对于a + space的情况需要考虑将末尾的空格先删去
        s_1 = s.split(' ')[-1]    #用一个新的变量s_1
        print(len(s_1))

def main():
    s = input('s = ')
    Solution().lengthOfLastWord(s)


if __name__ == '__main__':
    main()
